package org.example.hutool;

import cn.hutool.core.convert.Convert;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.lang.Filter;
import cn.hutool.core.lang.mutable.MutablePair;
import cn.hutool.json.JSONObject;

public class CovertUtil {

    public static void main(String[] args) {
        String jsonStr = json();
        System.out.println(jsonStr);
    }

    public static String covertToStr(Object obj) {
        Assert.notNull(obj, "传入对象不能为空");
        return Convert.toStr(obj);
    }

    public static Integer[] covertToIntArray(Object[] objArray) {
        Assert.notNull(objArray, "传入对象不能为空");
        return Convert.toIntArray(objArray);
    }

    public static String digitToChinese(Number money) {
        Assert.notNull(money, "转化金额不能为空");
        return Convert.digitToChinese(money);
    }

    public static String json(){
        Filter<MutablePair<Object, Object>> filter = pair -> !"zjamh".equals(pair.getValue());
        JSONObject jsonObject = new JSONObject();
        jsonObject.set("name","zjamh");
        jsonObject.set("age", 13);
        jsonObject.set("id", 134);
        String str = jsonObject.toJSONString(0, filter);
        return str;
    }

}
